#include "grflib_stdafx.h"
#include "../include/DXUTBindings.h"
#include "../include/D3D10Engine.h"

namespace grflib
{
	namespace engine
	{
		namespace D3D10
		{
            using namespace grflib::engine::core;

			//DXUT callbacks bindings
			HRESULT CALLBACK OnD3D10CreateDevice( ID3D10Device* pd3dDevice, const DXGI_SURFACE_DESC* pBufferSurfaceDesc, void* pUserContext )
			{
				return CEngine::Instance().DefaultOnCreate(pd3dDevice, pBufferSurfaceDesc, pUserContext);
			}

			HRESULT CALLBACK OnD3D10ResizedSwapChain( ID3D10Device* pd3dDevice, IDXGISwapChain* pSwapChain, const DXGI_SURFACE_DESC* pBufferSurfaceDesc, void* pUserContext )
			{
				return CEngine::Instance().DefaultOnResize(pd3dDevice, pSwapChain, pBufferSurfaceDesc, pUserContext);
			}

			void CALLBACK OnD3D10ReleasingSwapChain( void* pUserContext )
			{
				CEngine::Instance().DefaultOnRelease(pUserContext);
			}

			void CALLBACK OnD3D10DestroyDevice( void* pUserContext )
			{
				CEngine::Instance().DefaultOnDestroy(pUserContext);
			}

			void CALLBACK OnD3D10FrameRender( ID3D10Device* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext )
			{
				CEngine::Instance().DefaultRenderFrame(pd3dDevice, fTime, fElapsedTime, pUserContext);
			}

			LRESULT CALLBACK OnD3D10Msg( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool* pbNoFurtherProcessing, void* pUserContext )
			{
				return CEngine::Instance().DefaultMsgProc(hWnd, uMsg, wParam, lParam, pbNoFurtherProcessing, pUserContext);
			}

			void CALLBACK OnFrameMove( double fTime, float fElapsedTime, void* pUserContext )
			{
				CEngine::Instance().DefaultOnFrameMove(fTime, fElapsedTime, pUserContext);
			}

			bool CALLBACK ModifyDeviceSettings( DXUTDeviceSettings* pDeviceSettings, void* pUserContext )
			{
				return true;
			}

			bool CALLBACK IsD3D10DeviceAcceptable( UINT Adapter, UINT Output, D3D10_DRIVER_TYPE DeviceType, DXGI_FORMAT BufferFormat, bool bWindowed, void* pUserContext )
			{
				return true;
			}

		} //namespace D3D10
	} //namespace engine
} //